Fix dead code in content_block_stop handler and hardcoded provider names#1149
Closed
cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
Closed
Fix dead code in content_block_stop handler and hardcoded provider names#1149cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
cursor[bot] wants to merge 1 commit intocodething/648ca884-claudefrom
Conversation
- Remove dead tool lookup in ClaudeAdapter's content_block_stop handler that retrieved an in-flight tool but never used it - Replace hardcoded provider name comparison with Schema.is(ProviderKind) in ProviderCommandReactor for type-safe exhaustiveness checking Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
Two small code quality fixes in the server package:
ClaudeAdapter.ts: Removed dead code in the
content_block_stopstream event handler. The handler looked up an in-flight tool viacontext.inFlightTools.get(index)but did nothing with the result — the early return guard for missing tools and the fall-through for found tools both ended execution with no action.ProviderCommandReactor.ts: Replaced hardcoded
=== "codex" || === "claudeAgent"string comparison withSchema.is(ProviderKind)for type-safe provider validation. The previous approach would silently produceundefinedif a new provider were added to theProviderKindunion without updating this check, causing unnecessary session restarts.Why
handleUserMessageandcompleteTurn), the lookup was unnecessary.ProviderKindare automatically recognized.Checklist
Note
Fix hardcoded provider name checks and dead code in
content_block_stophandler"codex"/"claudeAgent"string checks in ProviderCommandReactor.ts with aSchema.is(ProviderKind)guard, so any validProviderKindvalue resolvescurrentProvidercorrectly.inFlightToolswhen acontent_block_stopevent had no matching assistant block.currentProvidernow matches any conformingProviderKindvalue rather than only the two previously hardcoded names.Macroscope summarized fab42af.